package com.csj.lc.conf;


import freemarker.template.TemplateModelException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;
import javax.servlet.ServletContext;

/**
 * 此类主要用于存储freemarker的全局设置
 */
@Configuration
public class FreemarkerConfig {

    @Autowired
    private ServletContext servletContext;

    @Autowired
    private freemarker.template.Configuration configuration;

    @PostConstruct
    public void setVariableConfiguration() throws TemplateModelException {
        configuration.setSharedVariable("hostUrl", servletContext.getContextPath());
        configuration.setSharedVariable("serverUrl", "http://192.168.31.235:8080/serverdemo/");
        configuration.setSharedVariable("serverName","LCServer后台管理系统");
    }

}

